#include<stdio.h>

int main(){
  int n = 0,i = 0;
  int sum = 0;
  scanf("%d",&n);
  for(i = 3;i < n;i += 3){
    sum += i;
  }
  for(i = 5;i < n;i += 5){
    sum += i;
  }
  printf("%d\n",sum);
  return 0;
}
